const fs = require('fs');

function readFilePromise(path) {
    return new Promise((resolve, reject) => {
        fs.readFile(path, 'utf-8', (error, data) => {
            if (error) reject(error);
            resolve(data);
        });
    });
}

readFilePromise('./app.js')
    .then(
        (res) => {
            console.log(res);
            return readFilePromise('./package.json');
        },
        (error) => {
            console.log(error);
        }
    )
    .then((res) => {
        console.log(res);
        return readFilePromise('./user.js');
    })
    .then((res) => {
        console.log(res);
    });
